package java05;

import java.util.ArrayDeque;
import java.util.Queue;
import java.util.Scanner;
public class Java56 {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		Queue<Integer> qa = new ArrayDeque<Integer>();
		Queue<Integer> qb = new ArrayDeque<Integer>();
		Queue<Integer> q_out = new ArrayDeque<Integer>();
		int n = Integer.parseInt(in.next());
		if(n<=1000)
		for (int i = 0; i < n; i++) {
			int a = Integer.parseInt(in.next());
			if(a%2==1)
				qa.add(a);
			else
				qb.add(a);
		}
		int x = qa.size()/2<qb.size()?qa.size()/2:qb.size();
		for (int i = 0; i < x;i++) {
			if(!qa.isEmpty())
				q_out.add(qa.poll());
			if(!qa.isEmpty())
				q_out.add(qa.poll());
			q_out.add(qb.poll());
		}
		if(!qa.isEmpty())
			q_out.addAll(qa);
		if(!qb.isEmpty())
			q_out.addAll(qb);
		int m = 0;
		for (Integer integer : q_out) {
			m++;
			System.out.print(integer);
			if(m!=q_out.size())
				System.out.print(" ");
		}
	}
}